package com.practice.exercise.service.impl;

import com.practice.exercise.dao.StudentMapper;
import com.practice.exercise.dao.TeacherMapper;
import com.practice.exercise.domain.User;
import com.practice.exercise.service.StudentInfoService;
import com.practice.exercise.service.TeacherInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class TeacherInfoServiceImpl implements TeacherInfoService {

    @Autowired
    private TeacherMapper teacherMapper;

    @Override
    public User findByTeacherId(Integer student_id) {
        return teacherMapper.findTeacherById(student_id);
    }

    @Override
    public void insertTeacher(User teacher) {
        teacherMapper.insertTeacher(teacher);
    }

    @Override
    public List<User> findAllTeacher() {
        return teacherMapper.findAllStudent();
    }

    @Override
    public void deleteTeacherById(Integer teacher_id) {
        teacherMapper.deleteTeacherById(teacher_id);
    }

    @Override
    public void UpdateTeacherById(User teacher) {
        teacherMapper.updateTeacherInfo(teacher);
    }
}
